import com.typesafe.sbt.SbtMultiJvm
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm




resolvers +=
  "oschina maven" at "http://maven.oschina.net/content/groups/public/"

resolvers +=
  "oschina maven thirdparty" at "http://maven.oschina.net/content/repositories/thirdparty/"

resolvers += "patriknw at bintray" at "http://dl.bintray.com/patriknw/maven"


lazy val lang = RootProject(file("../very-util-lang"))


lazy val config = RootProject(file("../very-util-config"))

lazy val akka = Project(id = "akka", base = file("."),settings = Project.defaultSettings ++ SbtMultiJvm.multiJvmSettings ++ Seq(
    name := "very-util-akka",
	version := "0.0.0",
	scalaVersion := "2.11.4",
    {
		val akkaVersion="2.3.8"
		libraryDependencies ++= Seq(
		"com.typesafe.akka" %% "akka-actor" % akkaVersion
		,"com.typesafe.akka" %% "akka-cluster" % akkaVersion
		,"com.typesafe.akka" %% "akka-mailboxes-common" % akkaVersion,
		"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
		"com.typesafe.akka" %% "akka-kernel" % akkaVersion,
		"com.typesafe.akka" %% "akka-contrib" % akkaVersion,
		"com.github.patriknw" %% "akka-data-replication" % "0.8"
		,"org.scalatest" %% "scalatest" % "2.2.1" % "test"
		)
	},
	unmanagedSourceDirectories in MultiJvm <<= Seq(baseDirectory(_ / "src/mult")).join,
	// make sure that MultiJvm test are compiled by the default test compilation
    compile in MultiJvm <<= (compile in MultiJvm) triggeredBy (compile in Test),
    // disable parallel tests
    parallelExecution in Test := false,
    // make sure that MultiJvm tests are executed by the default test target, 
    // and combine the results from ordinary test and multi-jvm tests
    executeTests in Test <<= (executeTests in Test, executeTests in MultiJvm) map {
      case (testResults, multiNodeResults)  =>
        val overall =
          if (testResults.overall.id < multiNodeResults.overall.id)
            multiNodeResults.overall
          else
            testResults.overall
        Tests.Output(overall,
          testResults.events ++ multiNodeResults.events,
          testResults.summaries ++ multiNodeResults.summaries)
    }
  )).dependsOn(lang,config).configs(MultiJvm)